#ifndef BASEMAINWIDGET_H
#define BASEMAINWIDGET_H

#include <QWidget>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QLabel>
#include <QIcon>
#include <QPushButton>
#include <QFrame>
#include "FramelessWidget.h"
#include "BaseWidgets_global.h"
#include "SettingWidget.h"


namespace UserManagementSystem {
//基本主窗口，包含框架：一个cameo图标，右侧的缩小，关闭按钮，已经一些功能组件

class BASEWIDGETS_EXPORT BaseMainWidget : public FramelessWidget
{
public:
    BaseMainWidget(QWidget* parent=nullptr);

    ///@brief 获得主布局
    QVBoxLayout* GetMainLayout()const;

public slots:
    void On_CloseBtn_clicked();
    void On_MinimumBtn_clicked();
    void On_SettingBtn_clicked();

private:
    //初始化布局
    void InitDefaultLayout();

    //初始化样式
    void InitDefaultStyle();

    //绑定信号槽函数
    void BindSlots();

    //为按钮加载图标资源,一个按钮，两个状态的资源文件路径，在该函数中拼接字符串，设置样式表
    void LoadIcon(QPushButton* btn,const QString path_1,const QString path_2);

    ///@brief 绘制圆角
    virtual void paintEvent(QPaintEvent *event) override;
private:
    //主布局
    QVBoxLayout* m_mainLayout=nullptr;

    //标题栏的子布局
    QHBoxLayout* m_subLayout=nullptr;

    ///@brief 左侧Cameo标题
    QLabel * m_titleLabel=nullptr;

    ///@brief 联网状态按钮
    QPushButton *m_netStatusBtn=nullptr;

    ///@brief 设置窗口按钮
    QPushButton *m_settingBtn=nullptr;

    ///@brief 诊所信息窗口
    QPushButton *m_clinicInfoBtn=nullptr;

    ///@brief 退出登录按钮
    QPushButton* m_logOutBtn=nullptr;

    ///@brief 分割竖线
    QFrame * m_vLine=nullptr;

    ///@brief 最小化
    QPushButton* m_minimumBtn=nullptr;

    ///@brief 关闭按钮
    QPushButton* m_closeBtn=nullptr;


private://Icon图标
    ///@brief label图标
    QIcon  m_labelIcon;

    ///@brief 联网图标
    QIcon  m_netIcon;

    ///@brief 设置图标
    QIcon  m_settingIcon;

    ///@brief 诊所信息图标
    QIcon  m_infoIcon;

    ///@brief 登出图标
    QIcon  m_logoutIcon;

    ///@brief 最小化窗口图标
    QIcon  m_minIcon;

    ///@brief 关闭窗口图标
    QIcon  m_closeIcon;
private:
    ///@brief 设置窗口
    UserManagementSystem::SettingWidget* m_settingWidget=nullptr;

};
}


#endif // BASEMAINWIDGET_H
